#!/usr/bin/env bash
cd /Workspace

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure –enable-ltdl-install
make
make install

cp /usr/local/lib/libmcrypt.* /usr/lib
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2


cd /Workspace

tar zxvf mcrypt-2.6.6.tar.gz
cd mcrypt-2.6.6/
./configure --disable-posix-threads
make
make install

cd /Workspace

tar -jxvf php-5.3.5.tar.bz2
cd php-5.3.5
./configure -with-mcrypt --prefix=/tools/php --with-apxs2=/tools/httpd/bin/apxs --with-mysql=/tools/mysql --with-gd --with-config-file-path=/tools/php --enable-mbstring=all --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization  --enable-mbregex --with-zlib --enable-sockets --enable-soap --enable-exif --with-zlib-dir --with-bz2 --with-libxml-dir  --with-openssl  --with-curl
make && make install
cp php.ini-production /tools/php/php.ini
libtool --finish /Workspace/php-5.3.3/libs
